﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SARUserControls
{
	/// <summary>
	/// 成像处理的进度条
	/// </summary>
	public partial class SARChengXiangChuLiStepBar : UserControl
	{
		private int currentStep = 0;
        private TextBlock[] titles;
        private Grid[] reachedPoints;
        private Grid[] unreachedPoints;

        public SARChengXiangChuLiStepBar()
        {
            this.InitializeComponent();
            titles = new TextBlock[3];
            titles[0] = txtStep1;
            titles[1] = txtStep2;
            titles[2] = txtStep8;

            reachedPoints = new Grid[3];
            reachedPoints[0] = reachedPoint1;
            reachedPoints[1] = reachedPoint2;
            reachedPoints[2] = reachedPoint8;

            unreachedPoints = new Grid[3];
            unreachedPoints[0] = unreachedPoint1;
            unreachedPoints[1] = unreachedPoint2;
            unreachedPoints[2] = unreachedPoint8;
        }


        public int SARCurrentStep
        {
            get { return currentStep; }
            set
            {
                if (value > 2)
                {
                    value = 2;
                }
                else if (value < 0)
                {
                    value = 0;
                }
                titles[currentStep].Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0x00, 0x0d, 0x13));
                
                titles[value].Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0x71, 0x8B, 0x15));
                
                for (int i = 0; i < 3; i++)
                {
                    if (i <= value)
                    {
                        reachedPoints[i].Visibility = System.Windows.Visibility.Visible;
                        unreachedPoints[i].Visibility = System.Windows.Visibility.Hidden;
                    }
                    else
                    {
                        reachedPoints[i].Visibility = System.Windows.Visibility.Hidden;
                        unreachedPoints[i].Visibility = System.Windows.Visibility.Visible;
                    }
                }
                greenBar.Width = 25.6 + value * 327.25;
                decoration.Width = 38 + value * 327.25;
                stepicon.Margin = new Thickness(16 + value * 327.25, stepicon.Margin.Top, stepicon.Margin.Right, stepicon.Margin.Bottom);
                currentStep = value;
            }
        }
	}
}